package logic.nodes.damagable;

import logic.DelayedController;

public class DamagableController extends DelayedController {
	
	private static final long serialVersionUID = 1L;
	
	public static final float SHIELD_COOL_DOWN = 5f;
	
	protected float coolDown;
	protected DamagableNode node;
	
	public DamagableController(DamagableNode node) {
		super(1f);
		this.node = node;
	}
	
	@Override
	public void delayedUpdate(float time) {
		if(coolDown != 0) coolDown--;
		else if(node.getCurrentShield() < node.getMaxShield()) 
			node.increaseShield(node.getShieldRecovery());
	}
	
	public void resetShieldCoolDown() {
		coolDown = SHIELD_COOL_DOWN;
	}
}